//app.js
App({
    onLaunch: function () {
        //调用API从本地缓存中获取数据
        var logs = wx.getStorageSync('logs') || []
        logs.unshift(Date.now())
        wx.setStorageSync('logs', logs)
        this.getUserInfo();
    },
    getUserInfo: function () {
        //调用登录接口
        wx.login({
            success: function (data) {
                if (data.errMsg == "login:ok") {
                    // 登陆成功
                    wx.setStorage({
                        key: "code",
                        data: data.code
                    })
                    wx.getUserInfo({
                        success: function (res) {
                            wx.setStorage({
                                key: "user",
                                data: res.userInfo
                            })
                        }
                    })
                }
            }
        })

    },
    globalData: {
        userInfo: null,
    },
    menus: [
            {
            icon: "/img/person.png",
            title: "个人中心",
            page: "../coach_index/main",
            },
            {
                icon: "/img/booking.png",
                title: "预约中心",
                page: "../coach_mana_booking/main",
            },
            {
                icon: "/img/cars.png",
                title: "车辆管理",
                page: "../coach_mana_car/main",
            },
            {
                icon: "/img/students.png",
                title: "学员管理",
                page: "../coach_mana_student/main",
            },
        ]
})